package edu.colorado.karl.databases;

import java.sql.Connection;

/**
 * Manages the opening and closing of connections to the Setpoints database.
 * Creating and closing connections are done via static methods so the classes
 * requesting a database connection must track the state of that connection
 * on their own.  No state about open connections is maintained inside <code>
 * SetpointsDatabaseConnector</code>.
 * @author Michael Knudson
 * @version 3/2/08
 */
public class SetpointsDatabaseConnector extends MySQLConnector {
	// Hidden constructor to prevent instantiation
	private SetpointsDatabaseConnector() {
		
	}
	
	/**
	 * Attempts to create a connection to the Setpoints database.
	 * @return if successful, a connection to the database, if unsuccessful 
	 * returns <code>null</code>.
	 */
	public static Connection getConnection() {
		return MySQLConnector.getConnection("jdbc:mysql://localhost/Setpoints");
	}
	
	/**
	 * Attempts to close an open connection to the Setpoints database.
	 * @param c		The connection to close
	*/
	public static void closeConnection(Connection c) {
		MySQLConnector.closeConnection(c, "Setpoints");
	}
}
